package com.le.dub.common;

import lombok.Data;

/**
 * @description:消息数据
 * @author: guole
 * @date: 2020/4/9
 */
@Data
public class Response {
    private String code;
    private String msg;
    private Object data;

    public static Response success() {
        Response response = new Response();
        response.setCode(ResultCode.SUCCESS.getCode());
        response.setMsg(ResultCode.SUCCESS.getMsg());
        return response;
    }

    public static Response success(Object data) {
        Response response = new Response();
        response.setCode(ResultCode.SUCCESS.getCode());
        response.setMsg(ResultCode.SUCCESS.getMsg());
        response.setData(data);
        return response;
    }

    public static Response error(ResultCode resultCode) {
        Response response = new Response();
        response.setCode(resultCode.getCode());
        response.setMsg(resultCode.getMsg());
        return response;
    }
    public static Response error(String code,String msg) {
        Response response = new Response();
        response.setCode(code);
        response.setMsg(msg);
        return response;
    }
}
